package demo.ssh.service;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import demo.ssh.dao.TestDao;
import demo.ssh.model.User;

@Service("service")
public class TestServiceImpl implements TestService {
	@Resource
	@Qualifier("daoImpl")
	TestDao dao;
	
	
	@Override
	@Transactional(propagation=Propagation.REQUIRED)
	public void servce() {
		dao.getUser(2);
		User u1=new User();
		u1.setName("Service 1");
		dao.saveUser(u1);
		u1=new User();
		u1.setName("Service 2");
		dao.saveUser(u1);
	}

}
